<?php $this->Html->addCrumb('My Message','/messages'); ?>
<?php $this->Html->addCrumb('Setting'); ?>
<div id="left" style="float:left;">

    <!-- begin all content here -->
    <!-- success --><!-- error -->
    <?php
    echo $this->Session->flash();
    if ($this->Session->check('Message.auth'))
        echo $this->Session->flash('auth');
    ?>
    <div class="global-title"><?php __('Settings'); ?></div>
    <div class="div_content">
        <div class="paging">
            <?php echo $this->element('message/top_menu'); ?>
	</div>
         <div style="height: 20px;">

  <div id='message_success'></div>
         </div>
        <div style="background:#ccc;font-size: 15px;color: black;padding: 5px;">
            Archive messages automatically after
        </div>

           <table id="category_table" cellspacing="0" class="tablesorter">
             <tbody>
                 <tr><td width="50px" align="center">
                <input type="radio" name="archive" class="archive" value="90" <?php if($users['User']['msg_archive']==90){?> checked="checked"<?php }?>/></td><td>90 days</td></tr>
             <tr><td width="50px" align="center"><input type="radio" name="archive" class="archive"  value="1"  <?php if($users['User']['msg_archive']==1){?> checked="checked"<?php }?>/></td><td>1 year</td></tr>
             <tr><td width="50px" align="center"><input type="radio" name="archive" class="archive"  value="0"  <?php if($users['User']['msg_archive']==0){?> checked="checked"<?php }?>/></td><td>Never</td></tr>
             <tbody>
             </table>

        <div style="background:#ccc;font-size: 15px;color: black;padding: 5px;">
            Delete messages automatically after
        </div>

           <table id="category_table" cellspacing="0" class="tablesorter">
             <tbody>
                 <tr><td width="50px" align="center"><input type="radio" name="delete" class="delete" value="90"  <?php if($users['User']['msg_delete']==90){?> checked="checked"<?php }?>/></td><td>90 days</td></tr>
             <tr><td width="50px" align="center"><input type="radio" name="delete" class="delete" value="1"  <?php if($users['User']['msg_delete']==1){?> checked="checked"<?php }?>/></td><td>1 year</td></tr>
             <tr><td width="50px" align="center"><input type="radio" name="delete" class="delete" value="0"  <?php if($users['User']['msg_delete']==0){?> checked="checked"<?php }?>/></td><td>Never</td></tr>
             <tbody>
             </table>
            </div>            
        </div>

        <!-- edit sidebar items here -->


<?php echo $this->Html->css('table_css');?>

<?php echo $html->script(array("jquery.pagination.js", "jquery.tablesorter.min.js", "jquery.tablednd.js")); ?>
<script type="text/javascript">

    jQuery(document).ready(function(){
        jQuery("#category_table").tablesorter({headers: {0:{sorter: false}, 1:{sorter: false}, 6:{sorter: false}}});

          //////////////////////////archieve mail////////////////////
                        jQuery(".archive").click(function()
			{
                           var mval=jQuery(this).val();

                           jQuery.ajax({
                                url : "<?php echo Configure::read('base_url'); ?>messages/setting_archieve/"+mval,
                                        success : function (html) {
                                jQuery('#message_success').html('Setting Updated successfully.');
                                jQuery('#message_success').addClass('msg_success');
                                jQuery("#message_success").show();
                                jQuery("#message_success").animate({ top: "0px"}, 1000 ).fadeOut(1000);
                                            }
                                        });
                                });

                                //////////////////////////delete mail////////////////////
                        jQuery(".delete").click(function()
			{
                           var mval=jQuery(this).val();

                           jQuery.ajax({
                                url : "<?php echo Configure::read('base_url'); ?>messages/setting_delete/"+mval,
                                        success : function (html) {
                                jQuery('#message_success').html('Setting Updated successfully.');
                                jQuery('#message_success').addClass('msg_success');
                                jQuery("#message_success").show();
                                jQuery("#message_success").animate({ top: "0px"}, 1000 ).fadeOut(1000);
                                            }
                                        });
                                });
    });
</script>